package zaplog

import (
	"go.uber.org/zap"
)

var (
	sugarLogger *zap.SugaredLogger
)

/**
 * 初始化日志
 */
func SetupLog(logcfg LogConfig) {
	logger := NewZapLog(logcfg)

	sugarLogger = logger.Sugar()
}

/**
 * 获取日志对象
 */
func GetLog() *zap.SugaredLogger {
	return sugarLogger
}

//默认日志打印实例方法
func Debug(args ...interface{}) {
	sugarLogger.Debug(args)
}

func Debugf(format string, v ...interface{}) {
	sugarLogger.Debugf(format, v...)
}

func Info(args ...interface{}) {
	sugarLogger.Info(args)
}

func Infof(format string, v ...interface{}) {
	sugarLogger.Infof(format, v...)
}

func Warn(args ...interface{}) {
	sugarLogger.Warn(args)
}

func Warnf(format string, v ...interface{}) {
	sugarLogger.Warnf(format, v...)
}

func Error(args ...interface{}) {
	sugarLogger.Error(args)
}

func Errorf(format string, v ...interface{}) {
	sugarLogger.Errorf(format, v...)
}

func Panic(args ...interface{}) {
	sugarLogger.Panic(args)
}

func Panicf(format string, v ...interface{}) {
	sugarLogger.Panicf(format, v...)
}
